/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * ConsultaCandidat.java
 *
 * Created on 27/03/2011, 02:06:30 AM
 */
package zonasoft.Vistas.Negocio;

import com.mysql.jdbc.Connection;
import java.awt.Color;
import java.util.ArrayList;
import java.util.Collection;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.swing.DefaultListModel;
import javax.swing.JOptionPane;
import javax.swing.ListModel;
import javax.swing.border.Border;
import javax.swing.plaf.BorderUIResource;
import javax.swing.text.Highlighter;
import zonasoft.Conceptos.Candidato;
import zonasoft.Conceptos.Especiales.Barrio;
import zonasoft.Conceptos.Lider;
import zonasoft.Conceptos.Puesto;
import zonasoft.Conceptos.Usuario;
import zonasoft.Conceptos.Zonificados;
import zonasoft.Manejadores.ManejadorBaseDatos;
import zonasoft.Manejadores.ManejadorCandidato;
import zonasoft.Manejadores.ManejadorLider;
import zonasoft.Manejadores.ManejadorLugar;
import zonasoft.Manejadores.ManejadorPuesto;
import zonasoft.Manejadores.ManejadorUsuario;
import zonasoft.Manejadores.ManejadorZonificados;
import zonasoft.Utilidades.Control;
import zonasoft.Utilidades.HTTPRequestPoster;
import zonasoft.Utilidades.ProcuraduriaInfo;
import zonasoft.Vistas.inicioSesion;

/**
 *
 * @author Usuario
 */
public class ModificarZonificado extends javax.swing.JFrame {

    HashMap<String, Integer> barrio;
    List listaBarrios = new ArrayList();
     private HashMap<String, Integer> puestos;
    ManejadorZonificados mz = new ManejadorZonificados();
    private HashMap<String, Integer> candidatos;
    private DefaultListModel modelistaOrganizaciones=new DefaultListModel();

    /** Creates new form ConsultaCandidat */
    public ModificarZonificado() {
        initComponents();
        this.setLocationRelativeTo(null);
        listaraCandidatos();
    }
    HashMap<String, Integer> elecciones;

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jXTaskPaneContainer1 = new org.jdesktop.swingx.JXTaskPaneContainer();
        jLabel1 = new javax.swing.JLabel();
        jXPanel2 = new org.jdesktop.swingx.JXPanel();
        BotonAceptar = new javax.swing.JButton();
        BotonConsultar = new javax.swing.JButton();
        BotonLimpiar = new javax.swing.JButton();
        RadioHabilitar = new javax.swing.JRadioButton();
        BotonModificar = new javax.swing.JButton();
        jXPanel5 = new org.jdesktop.swingx.JXPanel();
        jXPanel4 = new org.jdesktop.swingx.JXPanel();
        jLabel17 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        nombreLider = new javax.swing.JTextField();
        idLider = new javax.swing.JTextField();
        BotonConsultar1 = new javax.swing.JButton();
        jXPanel3 = new org.jdesktop.swingx.JXPanel();
        jLabel14 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        mesa = new javax.swing.JTextField();
        puesto = new javax.swing.JTextField();
        jScrollPane3 = new javax.swing.JScrollPane();
        direccionPuesto = new javax.swing.JTextArea();
        jXPanel1 = new org.jdesktop.swingx.JXPanel();
        campoNombre = new javax.swing.JTextField();
        campoProfesion = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        campotelefono = new javax.swing.JTextField();
        campoIdentificacion = new javax.swing.JTextField();
        jLabel13 = new javax.swing.JLabel();
        jLabel24 = new javax.swing.JLabel();
        campoCorreo = new javax.swing.JTextField();
        jLabel21 = new javax.swing.JLabel();
        campoRef = new javax.swing.JTextField();
        jLabel20 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        campoDireccion = new javax.swing.JTextArea();
        jLabel25 = new javax.swing.JLabel();
        comboBarrio = new javax.swing.JComboBox();
        jLabel19 = new javax.swing.JLabel();
        campoApellido = new javax.swing.JTextField();
        comboSexo = new javax.swing.JComboBox();
        jLabel22 = new javax.swing.JLabel();
        fechaNacimiento = new org.jdesktop.swingx.JXDatePicker();
        verificarDatos = new javax.swing.JButton();
        nombreOrg = new javax.swing.JLabel();
        comboOrganizacion = new javax.swing.JComboBox();
        jLabel30 = new javax.swing.JLabel();
        comboCandidato = new javax.swing.JComboBox();
        jScrollPane2 = new javax.swing.JScrollPane();
        listaOrganizaciones = new javax.swing.JList();
        nombreOrg1 = new javax.swing.JLabel();
        alerta = new javax.swing.JLabel();
        jXPanel6 = new org.jdesktop.swingx.JXPanel();
        jLabel26 = new javax.swing.JLabel();
        campoBarrio1 = new javax.swing.JTextField();
        jLabel27 = new javax.swing.JLabel();
        campoBarrio2 = new javax.swing.JTextField();
        franja = new javax.swing.JTextField();
        ucg = new javax.swing.JLabel();
        ucg1 = new javax.swing.JLabel();
        jXTaskPaneContainer2 = new org.jdesktop.swingx.JXTaskPaneContainer();
        jLabel28 = new javax.swing.JLabel();
        jXPanel7 = new org.jdesktop.swingx.JXPanel();
        jLabel2 = new javax.swing.JLabel();
        labelUsuario = new javax.swing.JLabel();
        fecg = new org.jdesktop.swingx.JXDatePicker();
        jLabel4 = new javax.swing.JLabel();
        jXTaskPaneContainer3 = new org.jdesktop.swingx.JXTaskPaneContainer();
        jLabel29 = new javax.swing.JLabel();

        setResizable(false);

        jLabel1.setFont(new java.awt.Font("Lucida Bright", 1, 18));
        jLabel1.setText("Modificacion de Zonificados");
        jXTaskPaneContainer1.add(jLabel1);

        jXPanel2.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED, java.awt.Color.lightGray, java.awt.Color.gray, java.awt.Color.lightGray, java.awt.Color.gray));

        BotonAceptar.setFont(new java.awt.Font("Lucida Bright", 1, 12));
        BotonAceptar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/zonasoft/Vistas/iconos/ok 32.png"))); // NOI18N
        BotonAceptar.setText("Aceptar");
        BotonAceptar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotonAceptarActionPerformed(evt);
            }
        });

        BotonConsultar.setFont(new java.awt.Font("Lucida Bright", 1, 12));
        BotonConsultar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/zonasoft/Vistas/iconos/search-icon2.png"))); // NOI18N
        BotonConsultar.setText("Consultar");
        BotonConsultar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotonConsultarActionPerformed(evt);
            }
        });

        BotonLimpiar.setFont(new java.awt.Font("Lucida Bright", 1, 12));
        BotonLimpiar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/zonasoft/Vistas/iconos/limpiar.png"))); // NOI18N
        BotonLimpiar.setText("Limpiar");
        BotonLimpiar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotonLimpiarActionPerformed(evt);
            }
        });

        RadioHabilitar.setFont(new java.awt.Font("Lucida Bright", 1, 12));
        RadioHabilitar.setText("Habilitar Campos");
        RadioHabilitar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RadioHabilitarActionPerformed(evt);
            }
        });

        BotonModificar.setFont(new java.awt.Font("Lucida Bright", 1, 12));
        BotonModificar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/zonasoft/Vistas/iconos/Box-Notes-icon.png"))); // NOI18N
        BotonModificar.setText("Modificar");
        BotonModificar.setEnabled(false);
        BotonModificar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotonModificarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jXPanel2Layout = new javax.swing.GroupLayout(jXPanel2);
        jXPanel2.setLayout(jXPanel2Layout);
        jXPanel2Layout.setHorizontalGroup(
            jXPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jXPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jXPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(BotonConsultar, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 156, Short.MAX_VALUE)
                    .addComponent(BotonAceptar, javax.swing.GroupLayout.DEFAULT_SIZE, 156, Short.MAX_VALUE)
                    .addComponent(BotonLimpiar, javax.swing.GroupLayout.DEFAULT_SIZE, 156, Short.MAX_VALUE)
                    .addComponent(BotonModificar, javax.swing.GroupLayout.DEFAULT_SIZE, 156, Short.MAX_VALUE)
                    .addComponent(RadioHabilitar, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 156, Short.MAX_VALUE))
                .addContainerGap())
        );
        jXPanel2Layout.setVerticalGroup(
            jXPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jXPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(RadioHabilitar)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(BotonConsultar, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(BotonModificar, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(BotonLimpiar, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(BotonAceptar)
                .addGap(36, 36, 36))
        );

        jXPanel5.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED, java.awt.Color.lightGray, java.awt.Color.lightGray, java.awt.Color.black, java.awt.Color.black));

        jXPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED, java.awt.Color.lightGray, java.awt.Color.lightGray, java.awt.Color.gray, java.awt.Color.gray), "Datos del Lider", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Lucida Bright", 1, 12))); // NOI18N

        jLabel17.setFont(new java.awt.Font("Lucida Bright", 0, 12));
        jLabel17.setText("Identificacion");

        jLabel18.setFont(new java.awt.Font("Lucida Bright", 0, 12));
        jLabel18.setText("Nombre");

        nombreLider.setEditable(false);

        idLider.setEditable(false);
        idLider.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                idLiderActionPerformed(evt);
            }
        });

        BotonConsultar1.setFont(new java.awt.Font("Lucida Bright", 1, 12));
        BotonConsultar1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/zonasoft/Vistas/iconos/search-icon2.png"))); // NOI18N
        BotonConsultar1.setText("Consultar");
        BotonConsultar1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotonConsultar1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jXPanel4Layout = new javax.swing.GroupLayout(jXPanel4);
        jXPanel4.setLayout(jXPanel4Layout);
        jXPanel4Layout.setHorizontalGroup(
            jXPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jXPanel4Layout.createSequentialGroup()
                .addGap(18, 18, 18)
                .addGroup(jXPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(nombreLider, javax.swing.GroupLayout.PREFERRED_SIZE, 192, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel18)
                    .addGroup(jXPanel4Layout.createSequentialGroup()
                        .addComponent(idLider, javax.swing.GroupLayout.PREFERRED_SIZE, 121, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(5, 5, 5)
                        .addComponent(BotonConsultar1))
                    .addComponent(jLabel17))
                .addContainerGap(11, Short.MAX_VALUE))
        );
        jXPanel4Layout.setVerticalGroup(
            jXPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jXPanel4Layout.createSequentialGroup()
                .addComponent(jLabel17)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jXPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jXPanel4Layout.createSequentialGroup()
                        .addComponent(idLider, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(21, 21, 21)
                        .addComponent(jLabel18))
                    .addComponent(BotonConsultar1, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(nombreLider, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(20, Short.MAX_VALUE))
        );

        jXPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED, java.awt.Color.lightGray, java.awt.Color.lightGray, java.awt.Color.gray, java.awt.Color.gray), "Datos Electorales", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Lucida Bright", 1, 12))); // NOI18N

        jLabel14.setFont(new java.awt.Font("Lucida Bright", 0, 12));
        jLabel14.setText("Puesto de Votacion");

        jLabel15.setFont(new java.awt.Font("Lucida Bright", 0, 12));
        jLabel15.setText("N° de Mesa");

        jLabel16.setFont(new java.awt.Font("Lucida Bright", 0, 12));
        jLabel16.setText("Direccion ");

        mesa.setEditable(false);
        mesa.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                mesaKeyTyped(evt);
            }
        });

        puesto.setEditable(false);

        direccionPuesto.setColumns(20);
        direccionPuesto.setEditable(false);
        direccionPuesto.setRows(5);
        jScrollPane3.setViewportView(direccionPuesto);

        javax.swing.GroupLayout jXPanel3Layout = new javax.swing.GroupLayout(jXPanel3);
        jXPanel3.setLayout(jXPanel3Layout);
        jXPanel3Layout.setHorizontalGroup(
            jXPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jXPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jXPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jXPanel3Layout.createSequentialGroup()
                        .addComponent(jLabel16)
                        .addGap(18, 18, 18)
                        .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 220, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jXPanel3Layout.createSequentialGroup()
                        .addGroup(jXPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel14)
                            .addComponent(puesto, javax.swing.GroupLayout.PREFERRED_SIZE, 202, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(30, 30, 30)
                        .addGroup(jXPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel15)
                            .addComponent(mesa, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap(151, Short.MAX_VALUE))
        );
        jXPanel3Layout.setVerticalGroup(
            jXPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jXPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jXPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel15)
                    .addComponent(jLabel14))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jXPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(mesa, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(puesto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jXPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel16)
                    .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jXPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.LOWERED, java.awt.Color.lightGray, java.awt.Color.lightGray, java.awt.Color.gray, java.awt.Color.gray), "Datos Zonificados", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 12))); // NOI18N

        campoNombre.setEditable(false);
        campoNombre.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                campoNombreKeyTyped(evt);
            }
        });

        campoProfesion.setEditable(false);
        campoProfesion.setText(".");
        campoProfesion.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                campoProfesionKeyTyped(evt);
            }
        });

        jLabel9.setFont(new java.awt.Font("Lucida Bright", 0, 12));
        jLabel9.setText("Nombre");

        jLabel10.setFont(new java.awt.Font("Lucida Bright", 0, 12));
        jLabel10.setText("Profesion");

        jLabel12.setFont(new java.awt.Font("Lucida Bright", 0, 12));
        jLabel12.setText("Telefono");

        jLabel11.setFont(new java.awt.Font("Lucida Bright", 0, 12));
        jLabel11.setText("Apellidos");

        campotelefono.setEditable(false);
        campotelefono.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                campotelefonoKeyTyped(evt);
            }
        });

        campoIdentificacion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                campoIdentificacionActionPerformed(evt);
            }
        });
        campoIdentificacion.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                campoIdentificacionKeyTyped(evt);
            }
        });

        jLabel13.setFont(new java.awt.Font("Lucida Bright", 0, 12));
        jLabel13.setText("Identificacion");

        jLabel24.setFont(new java.awt.Font("Lucida Bright", 0, 12));
        jLabel24.setText("correo");

        campoCorreo.setEditable(false);
        campoCorreo.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                campoCorreoKeyTyped(evt);
            }
        });

        jLabel21.setFont(new java.awt.Font("Lucida Bright", 0, 12));
        jLabel21.setText("Hoja Ref:");

        campoRef.setEditable(false);

        jLabel20.setFont(new java.awt.Font("Lucida Bright", 0, 12));
        jLabel20.setText("Direccion");

        campoDireccion.setColumns(20);
        campoDireccion.setEditable(false);
        campoDireccion.setRows(5);
        campoDireccion.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                campoDireccionKeyTyped(evt);
            }
        });
        jScrollPane1.setViewportView(campoDireccion);

        jLabel25.setFont(new java.awt.Font("Lucida Bright", 0, 12));
        jLabel25.setText("Barrio");

        listaraBarrios();
        comboBarrio.setEnabled(false);

        jLabel19.setFont(new java.awt.Font("Lucida Bright", 0, 12));
        jLabel19.setText("Sexo");

        campoApellido.setEditable(false);
        campoApellido.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                campoApellidoKeyTyped(evt);
            }
        });

        comboSexo.setFont(new java.awt.Font("Tahoma", 0, 12));
        comboSexo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Masculino", "Femenino" }));
        comboSexo.setEnabled(false);

        jLabel22.setFont(new java.awt.Font("Lucida Bright", 0, 12));
        jLabel22.setText("Fecha de Nacimiento");

        fechaNacimiento.setEditable(false);

        verificarDatos.setFont(new java.awt.Font("Tahoma", 1, 12));
        verificarDatos.setText("Verificar Datos");
        verificarDatos.setEnabled(false);
        verificarDatos.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                verificarDatosActionPerformed(evt);
            }
        });

        nombreOrg.setFont(new java.awt.Font("Lucida Bright", 0, 12));
        nombreOrg.setText("Organización");

        listaraBarrios();
        comboOrganizacion.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Independiente", "Adultos Mayores", "Cultura", "Deporte", "Discapacitados", "Electoral", "Madres Comunitarias", "Madres Fami", "Jóvenes", "Mujeres", "Politico", "Transporte", "Simpatizante" }));
        comboOrganizacion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                comboOrganizacionActionPerformed(evt);
            }
        });

        jLabel30.setFont(new java.awt.Font("Lucida Bright", 0, 12));
        jLabel30.setText("Candidato");

        listaraBarrios();

        jScrollPane2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jScrollPane2MouseClicked(evt);
            }
        });

        listaOrganizaciones.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                listaOrganizacionesMouseClicked(evt);
            }
        });
        jScrollPane2.setViewportView(listaOrganizaciones);

        nombreOrg1.setFont(new java.awt.Font("Lucida Bright", 0, 12));
        nombreOrg1.setText("Organizaciónes");

        javax.swing.GroupLayout jXPanel1Layout = new javax.swing.GroupLayout(jXPanel1);
        jXPanel1.setLayout(jXPanel1Layout);
        jXPanel1Layout.setHorizontalGroup(
            jXPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jXPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jXPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jXPanel1Layout.createSequentialGroup()
                        .addGroup(jXPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel22)
                            .addComponent(jLabel13)
                            .addComponent(jLabel9)
                            .addComponent(jLabel12)
                            .addComponent(jLabel25)
                            .addComponent(jLabel10))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jXPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(campoProfesion, javax.swing.GroupLayout.DEFAULT_SIZE, 181, Short.MAX_VALUE)
                            .addComponent(comboBarrio, 0, 181, Short.MAX_VALUE)
                            .addComponent(campoIdentificacion, javax.swing.GroupLayout.DEFAULT_SIZE, 181, Short.MAX_VALUE)
                            .addComponent(campotelefono, javax.swing.GroupLayout.DEFAULT_SIZE, 181, Short.MAX_VALUE)
                            .addComponent(campoNombre, javax.swing.GroupLayout.DEFAULT_SIZE, 181, Short.MAX_VALUE)
                            .addComponent(fechaNacimiento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(jXPanel1Layout.createSequentialGroup()
                        .addGroup(jXPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(nombreOrg)
                            .addComponent(jLabel30))
                        .addGap(44, 44, 44)
                        .addGroup(jXPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(comboCandidato, 0, 185, Short.MAX_VALUE)
                            .addComponent(comboOrganizacion, 0, 185, Short.MAX_VALUE))))
                .addGap(56, 56, 56)
                .addGroup(jXPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jXPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jLabel11)
                        .addComponent(jLabel19)
                        .addComponent(jLabel24))
                    .addGroup(jXPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jLabel20)
                        .addComponent(jLabel21, javax.swing.GroupLayout.Alignment.TRAILING))
                    .addComponent(nombreOrg1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jXPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jXPanel1Layout.createSequentialGroup()
                        .addComponent(verificarDatos)
                        .addContainerGap())
                    .addGroup(jXPanel1Layout.createSequentialGroup()
                        .addGroup(jXPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(campoCorreo, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 220, Short.MAX_VALUE)
                            .addComponent(comboSexo, javax.swing.GroupLayout.PREFERRED_SIZE, 138, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(campoApellido, javax.swing.GroupLayout.DEFAULT_SIZE, 220, Short.MAX_VALUE)
                            .addComponent(campoRef, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(75, 75, 75))
                    .addGroup(jXPanel1Layout.createSequentialGroup()
                        .addGroup(jXPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 221, Short.MAX_VALUE))
                        .addContainerGap(37, Short.MAX_VALUE))))
        );
        jXPanel1Layout.setVerticalGroup(
            jXPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jXPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jXPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel13)
                    .addComponent(campoIdentificacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(verificarDatos))
                .addGap(18, 18, 18)
                .addGroup(jXPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel9)
                    .addComponent(campoNombre, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(campoApellido, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel11))
                .addGap(18, 18, 18)
                .addGroup(jXPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel22)
                    .addComponent(fechaNacimiento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(comboSexo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel19))
                .addGap(18, 18, 18)
                .addGroup(jXPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(campoCorreo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel12)
                    .addComponent(campotelefono, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel24))
                .addGap(18, 18, 18)
                .addGroup(jXPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel10)
                    .addComponent(campoProfesion, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(campoRef, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel21))
                .addGap(25, 25, 25)
                .addGroup(jXPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jXPanel1Layout.createSequentialGroup()
                        .addGroup(jXPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel25)
                            .addComponent(comboBarrio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel20))
                        .addGap(18, 18, 18)
                        .addGroup(jXPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(nombreOrg)
                            .addComponent(comboOrganizacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jXPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel30)
                            .addGroup(jXPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(comboCandidato, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(nombreOrg1))))
                    .addGroup(jXPanel1Layout.createSequentialGroup()
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 64, Short.MAX_VALUE)))
                .addContainerGap())
        );

        alerta.setFont(new java.awt.Font("Tahoma", 1, 11));
        alerta.setForeground(new java.awt.Color(255, 51, 51));
        alerta.setText("Importante.. hay datos por guardar.");
        alerta.setVisible(false);

        javax.swing.GroupLayout jXPanel5Layout = new javax.swing.GroupLayout(jXPanel5);
        jXPanel5.setLayout(jXPanel5Layout);
        jXPanel5Layout.setHorizontalGroup(
            jXPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jXPanel5Layout.createSequentialGroup()
                .addGap(53, 53, 53)
                .addGroup(jXPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jXPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(alerta, javax.swing.GroupLayout.PREFERRED_SIZE, 393, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jXPanel5Layout.createSequentialGroup()
                        .addComponent(jXPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jXPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addContainerGap())
        );
        jXPanel5Layout.setVerticalGroup(
            jXPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jXPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(alerta)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jXPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jXPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jXPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jXPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(33, Short.MAX_VALUE))
        );

        jXPanel6.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED, java.awt.Color.lightGray, java.awt.Color.lightGray, java.awt.Color.gray, java.awt.Color.gray));

        jLabel26.setFont(new java.awt.Font("Lucida Bright", 0, 12));
        jLabel26.setText("Reside en:");

        campoBarrio1.setEditable(false);

        jLabel27.setFont(new java.awt.Font("Lucida Bright", 0, 12));
        jLabel27.setText("Vota en:");

        campoBarrio2.setEditable(false);

        franja.setEditable(false);

        ucg.setText("ucg");

        ucg1.setText("ucg");

        jLabel28.setBackground(new java.awt.Color(255, 102, 0));
        jLabel28.setFont(new java.awt.Font("Lucida Bright", 1, 12));
        jLabel28.setText("Analisis Zonificacion");
        jLabel28.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED, java.awt.Color.white, java.awt.Color.white, java.awt.Color.white, java.awt.Color.white));
        jXTaskPaneContainer2.add(jLabel28);

        javax.swing.GroupLayout jXPanel6Layout = new javax.swing.GroupLayout(jXPanel6);
        jXPanel6.setLayout(jXPanel6Layout);
        jXPanel6Layout.setHorizontalGroup(
            jXPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jXPanel6Layout.createSequentialGroup()
                .addGap(20, 20, 20)
                .addGroup(jXPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(campoBarrio2, javax.swing.GroupLayout.DEFAULT_SIZE, 146, Short.MAX_VALUE)
                    .addGroup(jXPanel6Layout.createSequentialGroup()
                        .addComponent(jLabel26)
                        .addGap(18, 18, 18)
                        .addComponent(ucg, javax.swing.GroupLayout.DEFAULT_SIZE, 69, Short.MAX_VALUE))
                    .addComponent(campoBarrio1, javax.swing.GroupLayout.DEFAULT_SIZE, 146, Short.MAX_VALUE)
                    .addGroup(jXPanel6Layout.createSequentialGroup()
                        .addComponent(jLabel27)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 42, Short.MAX_VALUE)
                        .addComponent(ucg1, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
            .addComponent(jXTaskPaneContainer2, javax.swing.GroupLayout.DEFAULT_SIZE, 176, Short.MAX_VALUE)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jXPanel6Layout.createSequentialGroup()
                .addGap(20, 20, 20)
                .addComponent(franja, javax.swing.GroupLayout.DEFAULT_SIZE, 146, Short.MAX_VALUE)
                .addContainerGap())
        );
        jXPanel6Layout.setVerticalGroup(
            jXPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jXPanel6Layout.createSequentialGroup()
                .addComponent(jXTaskPaneContainer2, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jXPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel26)
                    .addComponent(ucg, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(campoBarrio1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jXPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel27)
                    .addComponent(ucg1, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(campoBarrio2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(franja, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(8, Short.MAX_VALUE))
        );

        jXPanel7.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.LOWERED, java.awt.Color.lightGray, java.awt.Color.lightGray, java.awt.Color.gray, java.awt.Color.gray));

        jLabel2.setFont(new java.awt.Font("Lucida Bright", 1, 12));
        jLabel2.setText("Ingresado por");

        labelUsuario.setVerticalAlignment(javax.swing.SwingConstants.TOP);

        fecg.setEditable(false);

        jLabel4.setFont(new java.awt.Font("Lucida Bright", 1, 12));
        jLabel4.setText("el");

        jLabel29.setBackground(new java.awt.Color(255, 102, 0));
        jLabel29.setFont(new java.awt.Font("Lucida Bright", 1, 12));
        jLabel29.setText("Auditoria VRM");
        jLabel29.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED, java.awt.Color.white, java.awt.Color.white, java.awt.Color.white, java.awt.Color.white));
        jXTaskPaneContainer3.add(jLabel29);

        javax.swing.GroupLayout jXPanel7Layout = new javax.swing.GroupLayout(jXPanel7);
        jXPanel7.setLayout(jXPanel7Layout);
        jXPanel7Layout.setHorizontalGroup(
            jXPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jXPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jXPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel2)
                    .addComponent(labelUsuario, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel4))
                .addContainerGap(79, Short.MAX_VALUE))
            .addComponent(jXTaskPaneContainer3, javax.swing.GroupLayout.DEFAULT_SIZE, 174, Short.MAX_VALUE)
            .addGroup(jXPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(fecg, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(64, Short.MAX_VALUE))
        );
        jXPanel7Layout.setVerticalGroup(
            jXPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jXPanel7Layout.createSequentialGroup()
                .addComponent(jXTaskPaneContainer3, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(labelUsuario, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel4)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(fecg, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(28, 28, 28)
                .addComponent(jXPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(26, 26, 26)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jXPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jXPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jXPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addComponent(jXTaskPaneContainer1, javax.swing.GroupLayout.DEFAULT_SIZE, 1095, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jXTaskPaneContainer1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jXPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 220, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 52, Short.MAX_VALUE)
                        .addComponent(jXPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jXPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, 187, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jXPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGap(23, 23, 23))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void BotonAceptarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotonAceptarActionPerformed
        // TODO add your handling code here:
        this.dispose();
    }//GEN-LAST:event_BotonAceptarActionPerformed
    String idZ = "";
    private void BotonConsultarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotonConsultarActionPerformed
        // TODO add your handling code here:
        ManejadorBaseDatos manejabd = ManejadorBaseDatos.getInstancia();
        try {
            manejabd.conectar();
            ManejadorZonificados.con = manejabd.getConexion();
            ManejadorLider.conm = manejabd.getConexion();
            ManejadorPuesto.con = (Connection) manejabd.getConexion();
            ManejadorUsuario.conm = manejabd.getConexion();
            Zonificados zonificadoActual = null;
            Map<String, String> resultados = null;
            Zonificados zo = null;
            listaraPuestos();//traemos un listado de los puestos del sistema
            //  En esta variable guardo la identificacion vieja  -> System.out.println("idZ = " + idZ);
            idZ = campoIdentificacion.getText();
            zo = ManejadorZonificados.getZonificadosPropio(idZ);
//                  System.out.print(zo + " del consultar");
            if (!campoIdentificacion.getText().isEmpty()) {
                if (zo != null) {
                    // datos del zonificado
                    campoIdentificacion.setText(zo.getIdZonificado());
                    campoNombre.setText(zo.getNombres());
                    campoApellido.setText(zo.getApellidos());
                    fechaNacimiento.setDate(zo.getFechadeNacimiento());
                    campoProfesion.setText(zo.getCargo());
                    campotelefono.setText(zo.getTelefono());
                    campoCorreo.setText(zo.getCorreo());
                    campoRef.setText(zo.getCodHoja());
                    campoDireccion.setText(zo.getDireccion());
                    int sexo = (zo.getSexo());
                    comboSexo.setSelectedIndex(sexo);
//                    campoBarrio.setText(zo.getIdBarrio().toLowerCase());
                    String nombreBarrio = zo.getIdBarrio().toLowerCase();
                    int index = listaBarrios.indexOf(nombreBarrio);
                    comboBarrio.setSelectedIndex(index + 1);
                    // datos del lider
                    Lider li = null;
                    String idL = zo.getIdLider();
                    idLider.setText(idL);
                    li = ManejadorLider.getLider(idL);
                    if(li!=null)
                    nombreLider.setText(li.getNombre() + " " + li.getApellido());
                    if(zo.getIdCandidatos()!=null  && !zo.getIdCandidatos().isEmpty())
                    comboCandidato.setSelectedItem(zo.getIdCandidatos().get(0));
                  //Agregando ala lista las organizaciones alas que pertenece
                     String Pertenece="";
                         Pertenece=zo.getComite();
                         System.out.println("Pertenece = " + Pertenece);
                        if(Pertenece!=null  && !Pertenece.isEmpty())
                        {
                            String[] listaOrganizacionesP = Pertenece.split(",");
                        for (String org : listaOrganizacionesP) {
                            if(!org.equals(""))
                            modelistaOrganizaciones.addElement(org);
                        }
                       }
                        listaOrganizaciones.setModel(modelistaOrganizaciones);
                    // datos
//                 Puesto pu = null;
//               String idP = zo.getIdPuesto();
//                  pu = ManejadorPuesto.getPuesto(idP);                 
//                  direccionPuesto.setText(pu.getDireccion());
                    resultados = ManejadorZonificados.getDatosVotacion(zo.getIdPuesto());
                     if (resultados != null && !resultados.isEmpty()) {
                    puesto.setText(resultados.get("puesto"));
                    mesa.setText(zo.getNumeroMesa());
                    direccionPuesto.setText(resultados.get("barrio"));
                    // Parte de la franja
                    campoBarrio1.setText(zo.getIdBarrio());
                    campoBarrio2.setText(resultados.get("barrio"));
                    boolean answer = false;
                    int terceraRespuesta = -1;
                    Map<String, Integer> unidadesByBarrio = null;
                    Object[] resultado = ManejadorZonificados.validarZonificacion(zo.getIdBarrio(), resultados.get("barrio"));
                    unidadesByBarrio = (Map<String, Integer>) resultado[0];
                    answer = (Boolean) resultado[1];
                    terceraRespuesta = (Integer) resultado[2];
                    if (answer == true) {
                        franja.setBackground(Color.GREEN);
                    } else {
                        franja.setBackground(Color.red);
                    }
                    if (terceraRespuesta == 0) {
                        ucg.setText("UCG #" + String.valueOf(unidadesByBarrio.get(zo.getIdBarrio().toLowerCase())));
                        ucg1.setText("UCG #" + String.valueOf(unidadesByBarrio.get(resultados.get("barrio").toLowerCase())));
                    } else {
                        ucg.setText(String.valueOf(terceraRespuesta));
                        ucg1.setText(String.valueOf(terceraRespuesta));
                    }
                    //              // usuario
                    Usuario us = null;
                    us = inicioSesion.userActual;
                    labelUsuario.setText(us.getLogin_usuario());
                    java.util.Date fechaC = new java.util.Date(zo.getFechadeCreacion().getTime());
//                  labelFecha.setText(fechaC);
                    fecg.setDate(fechaC);
                    
                    }
                    verificarDatos.setEnabled(true);
                } else {
                    JOptionPane.showMessageDialog(null, " No se ha zonificado a esta persona", "Busqueda sin resultados", JOptionPane.INFORMATION_MESSAGE);
                    limpiar();
                }
            } else {
                JOptionPane.showMessageDialog(null, "Por favor digite la identificacion", "campo vacio", JOptionPane.PLAIN_MESSAGE);
                campoIdentificacion.requestFocus();
            }
        } catch (Exception ex) {
            Logger.getLogger(ModificarZonificado.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_BotonConsultarActionPerformed

    private void BotonLimpiarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotonLimpiarActionPerformed
        // TODO add your handling code here:
        limpiar();
        campoIdentificacion.requestFocus();
    }//GEN-LAST:event_BotonLimpiarActionPerformed

    private void campoIdentificacionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_campoIdentificacionActionPerformed
        // TODO add your handling code here:
        BotonConsultarActionPerformed(evt);
    }//GEN-LAST:event_campoIdentificacionActionPerformed

    private void RadioHabilitarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RadioHabilitarActionPerformed
        // TODO add your handling code here:
        habilitarCampos();
}//GEN-LAST:event_RadioHabilitarActionPerformed
   private void habilitarCampos()
   {
       if ((campoIdentificacion.getText().isEmpty()) && (campoNombre.getText().isEmpty())) {
            RadioHabilitar.setSelected(false);
            JOptionPane.showMessageDialog(null, "No hay campos que modificar", "Campos Vacios", JOptionPane.ERROR_MESSAGE);
            campoIdentificacion.requestFocus();
        } else {
            if (RadioHabilitar.isSelected() == true) {
                campoNombre.setEditable(true);
                campoApellido.setEditable(true);
                comboSexo.setEnabled(true);
                campoProfesion.setEditable(true);
                campotelefono.setEditable(true);
                campoCorreo.setEditable(true);
                campoRef.setEditable(true);
                campoDireccion.setEditable(true);
                comboBarrio.setEnabled(true);
                idLider.setEditable(true);
                fechaNacimiento.setEditable(true);
                BotonModificar.setEnabled(true);
                BotonConsultar.setEnabled(false);
                campoIdentificacion.requestFocus();
            } else {
                deshabilitar();
            }
            if (campoNombre.isEditable() == false) {
                RadioHabilitar.setSelected(false);
                BotonModificar.setEnabled(false);
            }
        }
   }
    private void BotonModificarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotonModificarActionPerformed
        // TODO add your handling code here:
// Validacion de los campos 
        if (campoNombre.getText().isEmpty()) {
            JOptionPane.showMessageDialog(null, "Campo nombre vacio", "Error", JOptionPane.WARNING_MESSAGE);
        } else if (campoNombre.isEditable() == false) {
            BotonModificar.setEnabled(false);
        } else if (campoApellido.getText().isEmpty()) {
            JOptionPane.showMessageDialog(null, "campo apellido vacio", "Error", JOptionPane.WARNING_MESSAGE);
        } else if (campoProfesion.getText().isEmpty()) {
            JOptionPane.showMessageDialog(null, "campo Profesion vacio", "Error", JOptionPane.WARNING_MESSAGE);
        } else if (campotelefono.getText().isEmpty()) {
            JOptionPane.showMessageDialog(null, "campo telefono vacio", "Error", JOptionPane.WARNING_MESSAGE);
        } else if(!campoCorreo.getText().contains("@") || !campoCorreo.getText().contains(".") ){
                JOptionPane.showMessageDialog(null, "Correo Invalido","error",JOptionPane.WARNING_MESSAGE);                   
               }else {
            ManejadorBaseDatos manejabd = ManejadorBaseDatos.getInstancia();
            try {
                manejabd.conectar();
                ManejadorZonificados.conm = manejabd.getConexion();
                Zonificados zon = new Zonificados();
                String id = idLider.getText();
                String Ide = campoIdentificacion.getText().trim();
                //Datos del Zonificado
                zon.setIdZonificado(campoIdentificacion.getText());
                zon.setNombres(campoNombre.getText());
                zon.setApellidos(campoApellido.getText());
                zon.setFechadeNacimiento(fechaNacimiento.getDate());
                //  int sexo = (zon.getSexo());
                //   comboSexo.setSelectedIndex(sexo);
                zon.setSexo(comboSexo.getSelectedIndex());
                zon.setCargo(campoProfesion.getText());
                zon.setTelefono(campotelefono.getText());
                zon.setCorreo(campoCorreo.getText());
                zon.setCodHoja(campoRef.getText());
                zon.setDireccion(campoDireccion.getText());
                zon.setIdBarrio(comboBarrio.getSelectedItem().toString());
                // datos del Lider
                zon.setIdLider(idLider.getText());
                zon.setNumeroMesa(mesa.getText());
                 String puestoNew=puesto.getText();
                int idNuevoPuesto=puestos.get(puestoNew);
                zon.setIdPuesto(String.valueOf(idNuevoPuesto));

                 String nombreCandidato = comboCandidato.getSelectedItem().toString();
                            int idCandidato = candidatos.get(nombreCandidato);
                            List<String> idCandidatos=new ArrayList<String>();
                            idCandidatos.add(String.valueOf(idCandidato));
                            zon.setIdCandidatos(idCandidatos);

                int nOrganizaciones=listaOrganizaciones.getModel().getSize();
                ListModel modelo=listaOrganizaciones.getModel();
                String organizaciones="";
                for (int i = 0; i < nOrganizaciones; i++) {
                    String  org = modelo.getElementAt(i).toString();
                    if(!org.equals(""))
                    organizaciones+=org+",";
                }
                //para eliminar la ultima coma
                 if (organizaciones.lastIndexOf(",") > 0) {
                    organizaciones = organizaciones.substring(0, organizaciones.lastIndexOf(","));
                }

                zon.setComite(organizaciones);

//                System.out.println("Ide ( zonificado viejo) = " + Ide);
//                System.out.println("IdZ (zonificado nuevo)  = " + idZ);
                ManejadorZonificados.ModificarZonificado(zon, idZ);
                JOptionPane.showMessageDialog(null, " Zonificado modificado con exito", " Modificacion Exitosa", JOptionPane.INFORMATION_MESSAGE);
                limpiar();
                deshabilitar();
                verificarDatos.setEnabled(false);
                alerta.setVisible(false);
            } catch (Exception ex) {
                Logger.getLogger(ModificarZonificado.class.getName()).log(Level.SEVERE, null, ex);
            } // catch
        }  // else 
    }//GEN-LAST:event_BotonModificarActionPerformed

    public void deshabilitar() {
        campoNombre.setEditable(false);
        campoApellido.setEditable(false);
        comboSexo.setEnabled(false);
        campoProfesion.setEditable(false);
        campotelefono.setEditable(false);
        campoCorreo.setEditable(false);
        campoRef.setEditable(false);
        campoDireccion.setEditable(false);
        comboBarrio.setEnabled(false);
        fechaNacimiento.setEditable(false);
        idLider.setEditable(false);

        RadioHabilitar.setSelected(false);
        BotonModificar.setEnabled(false);

        BotonConsultar.setEnabled(true);
        campoIdentificacion.requestFocus();
    }

    private void BotonConsultar1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotonConsultar1ActionPerformed
        ManejadorBaseDatos manejabd = ManejadorBaseDatos.getInstancia();
        try {
            manejabd.conectar();
            ManejadorLider.conm = manejabd.getConexion();
            Lider li = new Lider();
            li = ManejadorLider.getLider(idLider.getText());
            if (li != null) {
                nombreLider.setText(li.getNombre().replace("_", "") + " " + li.getApellido());
            } else {
                JOptionPane.showMessageDialog(null, " Busqueda de lider sin resultados", "Busqueda sin resultados", JOptionPane.INFORMATION_MESSAGE);
            }
        } catch (Exception ex) {
            // Logger.getLogger(ConsultaEleccion.class.getName()).log(Level.SEVERE, null, ex);
            JOptionPane.showMessageDialog(null, " Este Lider no Existe", "Busqueda sin resultados", JOptionPane.INFORMATION_MESSAGE);
            ex.printStackTrace();
        }
}//GEN-LAST:event_BotonConsultar1ActionPerformed

    private void idLiderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_idLiderActionPerformed
        // TODO add your handling code here:
        BotonConsultar1ActionPerformed(evt);
    }//GEN-LAST:event_idLiderActionPerformed

    private void verificarDatosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_verificarDatosActionPerformed
        // TODO add your handling code here:
        String nombreZoni = campoNombre.getText();
        String apellidoZoni = campoApellido.getText();
        String puestoVota = puesto.getText();
        String mesaVota = mesa.getText();
        String direccionVota = direccionPuesto.getText();


        // si el campo no esta vacio, consultame
        if (!campoIdentificacion.getText().isEmpty()) {
            String id = campoIdentificacion.getText().trim();
            HTTPRequestPoster.consultarDatos(id);
            String Departamento = HTTPRequestPoster.datosFinales.get("departamento");
            String municipio = HTTPRequestPoster.datosFinales.get("municipio");
            String puesto_ = HTTPRequestPoster.datosFinales.get("puesto");
            String mesa_ = HTTPRequestPoster.datosFinales.get("mesa");
            String direccion = HTTPRequestPoster.datosFinales.get("direccion");
            if (!puestoVota.equals(puesto_)) {
                puesto.setText(puesto_);
                puesto.setBackground(Color.getHSBColor(204, 59, 99));
                alerta.setVisible(true);
                BotonModificar.setEnabled(true);
                BotonConsultar.setEnabled(false);
                RadioHabilitar.setSelected(true);
                habilitarCampos();
            }

//        if(!direccion.contentEquals(direccionVota))
//        {
//        direccionPuesto.setText(direccion);
//        }

            if (!mesaVota.equals(mesa_)) {
                System.out.println(mesa_ + " == " + mesaVota);
                mesa.setText(mesa_);
                mesa.setBackground(Color.getHSBColor(204, 59, 99));
                alerta.setVisible(true);
                BotonModificar.setEnabled(true);
                BotonConsultar.setEnabled(false);
                RadioHabilitar.setSelected(true);
                habilitarCampos();
            }
            String[] datosPersonales = null;
            datosPersonales = ProcuraduriaInfo.informacionPersona(id);
            if (datosPersonales != null) {

                datosPersonales=datosProcuraduriaCorregidos(datosPersonales);
                String nombreProcu = datosPersonales[0];
                String apellidoProcu = datosPersonales[1];

                if (!nombreZoni.equals(nombreProcu)) {
                    campoNombre.setText(nombreProcu);
                    campoNombre.setBackground(Color.getHSBColor(204, 59, 99));
                    alerta.setVisible(true);
                    BotonModificar.setEnabled(true);
                    BotonConsultar.setEnabled(false);
                    RadioHabilitar.setSelected(true);
                    habilitarCampos();
                }
                if (!apellidoZoni.equals(apellidoProcu)) {
                    campoApellido.setText(apellidoProcu);
                    campoApellido.setBackground(Color.getHSBColor(204, 59, 99));
                    alerta.setVisible(true);
                    BotonModificar.setEnabled(true);
                    BotonConsultar.setEnabled(false);
                    RadioHabilitar.setSelected(true);
                   habilitarCampos();
                }

            }
        } else {
            JOptionPane.showMessageDialog(null, "campo identificacion vacio", "campos vacio", JOptionPane.WARNING_MESSAGE);
        }
    }//GEN-LAST:event_verificarDatosActionPerformed

    public String[] datosProcuraduriaCorregidos(String [] datos)
    {
      String[] datosOk=new String[2];
      int tam=datos.length;
      int n=tam;
      boolean tieneDe=false;
        System.out.println("tam = " + tam);
      String name="";

        for (String d : datos) {
            if(d.equalsIgnoreCase("de"))
            {
                tieneDe = true;
                break;

            }

        }
        if(tieneDe)
        {
         n=tam-1;
        }

        for (int i = 0; i < (n-2); i++) {
            name+= datos[i]+" ";


        }
      datosOk[0]=name;
      if(!tieneDe)
      {
          datosOk[1] = datos[tam - 2] + " " + datos[tam - 1];
      }
     else
          {
          datosOk[1] = datos[tam - 3] + " DE " + datos[tam - 1];
        }

      return datosOk;
    }


    private void campoIdentificacionKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_campoIdentificacionKeyTyped
        // TODO add your handling code here:
        Control.validaNumeros(evt, campoIdentificacion, 20);
    }//GEN-LAST:event_campoIdentificacionKeyTyped

    private void campoNombreKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_campoNombreKeyTyped
        // TODO add your handling code here:
        Control.validaLetras(evt, campoNombre, 45);
    }//GEN-LAST:event_campoNombreKeyTyped

    private void campoApellidoKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_campoApellidoKeyTyped
        // TODO add your handling code here:
        Control.validaLetras(evt, campoApellido, 45);
    }//GEN-LAST:event_campoApellidoKeyTyped

    private void campoCorreoKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_campoCorreoKeyTyped
        // TODO add your handling code here:
        Control.validaCantidad(evt, campoCorreo, 45);
    }//GEN-LAST:event_campoCorreoKeyTyped

    private void campotelefonoKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_campotelefonoKeyTyped
        // TODO add your handling code here:
        Control.validaNumeros(evt, campotelefono, 45);
    }//GEN-LAST:event_campotelefonoKeyTyped

    private void campoProfesionKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_campoProfesionKeyTyped
        // TODO add your handling code here:
        Control.validaCantidad(evt, campoProfesion, 45);
    }//GEN-LAST:event_campoProfesionKeyTyped

    private void campoDireccionKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_campoDireccionKeyTyped
        // TODO add your handling code here:
        Control.validaCantidadA(evt, campoDireccion, 45);
    }//GEN-LAST:event_campoDireccionKeyTyped

    private void mesaKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_mesaKeyTyped
        // TODO add your handling code here:
    }//GEN-LAST:event_mesaKeyTyped

    private void comboOrganizacionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboOrganizacionActionPerformed
        // TODO add your handling code here:
           String opcion=comboOrganizacion.getSelectedItem().toString();
        int nOrganizaciones=listaOrganizaciones.getModel().getSize();
        ListModel modelo=listaOrganizaciones.getModel();
        boolean esta=false;
        for (int i = 0; i < nOrganizaciones; i++) {
            String  org = modelo.getElementAt(i).toString();
            if(org.equals(opcion))
            {
             esta=true;break;
            }

        }
        if(!esta)
        {
            modelistaOrganizaciones.addElement(opcion);
            listaOrganizaciones.setModel(modelistaOrganizaciones);

        }
    }//GEN-LAST:event_comboOrganizacionActionPerformed

    private void jScrollPane2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jScrollPane2MouseClicked
        // TODO add your handling code here:
    }//GEN-LAST:event_jScrollPane2MouseClicked

    private void listaOrganizacionesMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_listaOrganizacionesMouseClicked
        // TODO add your handling code here:
         if (evt.getClickCount() == 2) {
            int index = listaOrganizaciones.locationToIndex(evt.getPoint());
             modelistaOrganizaciones.remove(index);
            listaOrganizaciones.setModel(modelistaOrganizaciones);
        }
    
    }//GEN-LAST:event_listaOrganizacionesMouseClicked

    public void limpiar() {
        campoIdentificacion.setText("");
        campoNombre.setText("");
        campoApellido.setText("");
        fechaNacimiento.setDate(null);
        campoProfesion.setText("");
        campotelefono.setText("");
        campoCorreo.setText("");
        campoRef.setText("");
        campoDireccion.setText("");
        idLider.setText("");
        nombreLider.setText("");
        puesto.setText("");
        mesa.setText("");
        direccionPuesto.setText("");
        comboBarrio.setSelectedIndex(0);
        comboSexo.setSelectedIndex(0);

        campoBarrio1.setText("");
        campoBarrio2.setText("");

        ucg.setText("ucg");
        ucg1.setText("ucg");
        franja.setBackground(campoRef.getBackground());

        labelUsuario.setText("");
        BotonConsultar.setEnabled(true);
        RadioHabilitar.setSelected(false);

        alerta.setVisible(false);
        campoNombre.setBackground(campoRef.getBackground());
        campoApellido.setBackground(campoRef.getBackground());
        mesa.setBackground(campoRef.getBackground());
        puesto.setBackground(campoRef.getBackground());


        modelistaOrganizaciones=new DefaultListModel();
        listaOrganizaciones.setModel(modelistaOrganizaciones);

    }

    public void listaraBarrios() {
        ManejadorBaseDatos mbd = ManejadorBaseDatos.getInstancia();
        barrio = new HashMap<String, Integer>();
        try {
            mbd.conectar();
            ManejadorLugar.con = (Connection) mbd.getConexion();
            comboBarrio.removeAllItems();
            List listarBarrio = null;
            listarBarrio = ManejadorLugar.listarBarrios();
            Iterator<Barrio> iter = listarBarrio.iterator();
            Barrio bar = null;
            comboBarrio.addItem("-- Seleccione un Barrio --");
            while (iter.hasNext()) {
                bar = iter.next();
                int idBarrio = Integer.parseInt(bar.getIdBarrio());
                comboBarrio.addItem(bar.getNombre());
                barrio.put(bar.getNombre(), idBarrio);
                listaBarrios.add(bar.getNombre().toLowerCase());
            }
        } catch (Exception ex) {
            Logger.getLogger(RegistrarPuesto.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public void listaraPuestos() {
        ManejadorBaseDatos mbd = ManejadorBaseDatos.getInstancia();
        puestos = new HashMap<String, Integer>();
        try {
            mbd.conectar();
            ManejadorPuesto.con = (Connection) mbd.getConexion();
            List listarPuestos = null;

                listarPuestos = ManejadorPuesto.listarPuestos();
                Iterator<Puesto> iter = listarPuestos.iterator();
                Puesto pue = null;
                while (iter.hasNext()) {
                    pue = iter.next();
//                    System.out.println("pue.getIdPuesto() = " + pue.getIdPuesto());
                    int codigoPuesto = Integer.parseInt(pue.getIdPuesto());
                    String nombre = pue.getNombrePuesto();
                    puestos.put(nombre, codigoPuesto);
//           puestos2.put(pue.getIdPuesto(), nombre );
            }
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }// fin del listar Puestos
      public void listaraCandidatos() {
        ManejadorBaseDatos mbd = ManejadorBaseDatos.getInstancia();
        candidatos = new HashMap<String, Integer>();
        try {
            mbd.conectar();
            ManejadorCandidato.con = (Connection) mbd.getConexion();
            comboCandidato.removeAllItems();

            Collection listarDepartamento = null;
            listarDepartamento = ManejadorCandidato.listaAllCandidato();
            Iterator<Candidato> iter = listarDepartamento.iterator();
            Candidato ca = null;
            comboCandidato.addItem("--Seleccione un Candidato---");
            while (iter.hasNext()) {
                ca = iter.next();
                int codigoCandidato = Integer.parseInt(ca.getIdCandidato());
                comboCandidato.addItem(ca.getNombre());
                candidatos.put(ca.getNombre(), codigoCandidato);
            }
            comboCandidato.setSelectedItem("Campo Elias Teheran Dix");
        } catch (Exception ex) {
            ex.printStackTrace();
        }

    }


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton BotonAceptar;
    private javax.swing.JButton BotonConsultar;
    private javax.swing.JButton BotonConsultar1;
    private javax.swing.JButton BotonLimpiar;
    private javax.swing.JButton BotonModificar;
    private javax.swing.JRadioButton RadioHabilitar;
    private javax.swing.JLabel alerta;
    private javax.swing.JTextField campoApellido;
    private javax.swing.JTextField campoBarrio1;
    private javax.swing.JTextField campoBarrio2;
    private javax.swing.JTextField campoCorreo;
    private javax.swing.JTextArea campoDireccion;
    private javax.swing.JTextField campoIdentificacion;
    private javax.swing.JTextField campoNombre;
    private javax.swing.JTextField campoProfesion;
    private javax.swing.JTextField campoRef;
    private javax.swing.JTextField campotelefono;
    private javax.swing.JComboBox comboBarrio;
    private javax.swing.JComboBox comboCandidato;
    private javax.swing.JComboBox comboOrganizacion;
    private javax.swing.JComboBox comboSexo;
    private javax.swing.JTextArea direccionPuesto;
    private org.jdesktop.swingx.JXDatePicker fecg;
    private org.jdesktop.swingx.JXDatePicker fechaNacimiento;
    private javax.swing.JTextField franja;
    private javax.swing.JTextField idLider;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel28;
    private javax.swing.JLabel jLabel29;
    private javax.swing.JLabel jLabel30;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private org.jdesktop.swingx.JXPanel jXPanel1;
    private org.jdesktop.swingx.JXPanel jXPanel2;
    private org.jdesktop.swingx.JXPanel jXPanel3;
    private org.jdesktop.swingx.JXPanel jXPanel4;
    private org.jdesktop.swingx.JXPanel jXPanel5;
    private org.jdesktop.swingx.JXPanel jXPanel6;
    private org.jdesktop.swingx.JXPanel jXPanel7;
    private org.jdesktop.swingx.JXTaskPaneContainer jXTaskPaneContainer1;
    private org.jdesktop.swingx.JXTaskPaneContainer jXTaskPaneContainer2;
    private org.jdesktop.swingx.JXTaskPaneContainer jXTaskPaneContainer3;
    private javax.swing.JLabel labelUsuario;
    private javax.swing.JList listaOrganizaciones;
    private javax.swing.JTextField mesa;
    private javax.swing.JTextField nombreLider;
    private javax.swing.JLabel nombreOrg;
    private javax.swing.JLabel nombreOrg1;
    private javax.swing.JTextField puesto;
    private javax.swing.JLabel ucg;
    private javax.swing.JLabel ucg1;
    private javax.swing.JButton verificarDatos;
    // End of variables declaration//GEN-END:variables
}
